home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Wonky Flux Batch 2019 02
/
Wonky_Flux_Batch_2019-02.zip
/
Wonky Flux Batch 2019-02
/
075 - Clash of Arms.dsk
/
NEW.ARMY2.S
< prev
next >
Wrap
Text File
|
2019-02-17
|
11KB
|
342 lines
public viewmap
on nocar goto link.term
gosub home
use "a:scroll.dn"
ch$=pc$
open #1,"h:war.map1":open #2,"h:war.map2"
gosub scanmap
nc=kc
close #1:open #1,"H:COORDS"
position #1,8,0:input #1 ky,ky
if ky<24 ma=0:mp=0:bo=24:yy=2:yo=2:tp=1:else mp=1:bo=47:yy=25:yo=25:ma=1:tp=24
close
open #1,"h:war.map1":open #2,"h:war.map2"
xx=2:xo=2:so=2:kc=0:te=1
gosub pmap
sy=2:nn=ab
na=0
y=yy:gosub getline1
placearmy
x=xx:y=sy:gosub screen:gosub invoff:print mid$(l1$,xx,1);
gosub readcoords
y=yy:gosub getline1
if yy<tp gosub scr1:else if yy>(tp+22) gosub scr2
sy=(yy-tp)+1:y=sy
x=xx:y=yy:gosub getline1:y=sy:gosub screen
gosub invon:print mid$(l1$,xx,1);:gosub invoff
x=xx:y=yy:gosub armystrength
x=1:y=24:gosub screen:print "Armies: ";ar;" ";
x=18:y=24:gosub screen:print"Army "na+1"("nn"): < > Change City, (1-9) Place Army, (ESC) abort";
gosub getkey
if (ka$=">") or (ka$=".") ka=1:else ka=0
if (ka$="<") or (ka$=",") kb=1:else kb=0
if ((ka=1) and (kc<nc)) kc=kc+1:goto placearmy
if ((kb=1) and (kc>0)) kc=kc-1:goto placearmy
if ka$=chr$(27) gosub home:link "a:war.start","fromnew"
if not(val(ka$)) goto placearmy
ka=val(ka$):if ka=0 goto placearmy
if ka+ar>9 x=18:y=24:gosub screen:print "No more than nine armies per stack. Press a key ";:gosub getkey:goto placearmy
if na+ka>nn x=18:y=24:gosub screen:print "You don't have that many armies. Press a key ";:gosub getkey:goto placearmy
gosub newarmies
goto placearmy
viewmap
use "a:scroll.dn"
on nocar goto link.term
open #1,"h:war.map1":open #2,"h:war.map2"
gosub home:bo=24
tp=1
sy=1
poke 34,0
xx=2:yy=2:xo=2:yo=2:so=2:sy=2:te=0
gosub printmap
ch$=pc$
nn=ab
x=xx:y=yy:gosub getline1:y=sy:gosub screen
gosub invon:print mid$(l1$,xx,1);:gosub invoff
y=24:x=40:gosub screen:print "Explore Map. Press <cr> to exit.";
gosub mapmove
gosub home
link "a:war.start","maincommand"
scr1
kb=yy:kd=tp
for ka=1 to (tp-yy):yy=kd-ka:gosub scrd2:next
yy=kb
tp=yy
return
scr2
kb=yy:kd=tp+22
for ka=1 to (yy-(tp+22)):yy=kd+ka:gosub scru2:next
yy=kb
tp=yy-22
return
NewArmies
ar=ar+ka
b$=chr$(ar+48)
position #2,80,yy-1,xx-1
print #2,b$ ;
x=xx:y=yy:gosub getline1:gosub armystrength
x=1:y=bo:gosub screen:print "Armies: ";ar;" ";
ab=ab-ka:na=na+ka:if na<nn return
x=xx:y=sy:gosub screen:gosub invoff:print mid$(l1$,xx,1);
gosub home
link "a:war.start","fromnew"
getkey
ka=key(0):if ka=0 goto getkey
ka$=chr$(ka)
if asc(ka$)>96 ka$=chr$(asc(ka$)-32)
poke 99,0:poke 100,0
return
scrolldown
if (an=1) and (info(0)) print #4,"3r";
if (info(0)) and (pt=1) y=23:x=1:gosub screen:print #4,"";
x=1:y=1:gosub screen:if (info(0)) and (pt=1) print #4,"";
if (info(0)) and (an=1) print #4,"M";
close
call -25088
open #1,"h:war.map1":open #2,"h:war.map2"
y=yy-1:gosub getline1
x=1:y=1:gosub screen
print l1$ ;
ys=ys+1
ke=ke+1
tp=tp-1
if (info(0)) and (an=1) print #4,"4r";
return
scrollup
if (an=1) and (info(0)) print #4,"3r";
x=1:y=1:gosub screen:if (info(0)) and (pt=1) print #4,"";
if (info(0)) and (an=1) x=79:y=23:gosub screen:print #4,""
x=1:y=23:gosub screen:if (info(0)) and (pt=1) print #4,"";
poke 35,23
y=yy+1:gosub getline1
x=1:y=23:gosub screen:print #3
gosub screen
print l1$ ;
poke 35,24
tp=tp+1
ys=ys-1
ke=ke-1
if (info(0)) and (an=1) print #4,"4r";
return
map2
if (ka$="K") and (xx<70) xx=xx+10:gosub erase:goto mapmv2
if (ka$="J") and (xx>10) xx=xx-10:gosub erase:goto mapmv2
if (ka$="I") and (sy>5) sy=sy-4:yy=yy-4:gosub erase:goto mapmv2
if (ka$="M") and (sy<19) sy=sy+4:yy=yy+4:gosub erase:goto mapmv2
if (ka$="I") and (tp>5) gosub erase:yy=tp-4:gosub scr3:sy=(yy-tp)+1:so=sy:xo=xx:yo=yy:goto mapmv2
if (ka$="M") and (tp<20) gosub erase:yy=tp+26:gosub scr4:sy=(yy-tp)+1:so=sy:xo=xx:yo=yy:goto mapmv2
mapmove
gosub getkey
if instr(ka$,"IJKM") goto map2
if instr(ka$,"147QAZ") ml=1:else ml=0
if instr(ka$,"369CDE") mr=1:else mr=0
if (ml) and (xx<>1) xx=xx-1:gosub erase
if (mr) and (xx<79) xx=xx+1:gosub erase
if instr(ka$,"QE79") ka$="8":else if instr(ka$,"ZC13") ka$="2"
if ((ka$="8") or (ka$='W')) and (sy<=2) and (yy>2) gosub erase:yy=yy-1:gosub scrolldown:xo=xx:yo=yy:so=sy:goto mapmv2
if ((ka$="2") or (ka$='X')) and (sy>=22) and (yy<45) gosub erase:yy=yy+1:gosub scrollup:xo=xx:yo=yy:so=sy:goto mapmv2
if ((ka$="8") or (ka$='W')) and (sy>2) yy=yy-1:sy=sy-1:gosub erase:goto mapmv2
if ((ka$="2") or (ka$='X')) and (sy<22) yy=yy+1:sy=sy+1:gosub erase:goto mapmv2
if ((ka$="8") or (ka$='W')) and (yy=2) goto mapmove
if ((ka$="2") or (ka$='X')) and (yy=45) goto mapmove
mapmv2
if ka$=chr$(27) return
if ka$=chr$(13) return
if instr(ka$," YN5") return
y=yy:gosub getline1
x=xx:y=sy:gosub screen:gosub invon:print mid$(l1$,xx,1);chr$(8);:gosub invoff
if ok ok=0:return
if instr(mid$(l1$,xx,1),"ABCDEF") x=9:y=24:gosub screen:gosub armystrength:print ar;" ";:else if ar<>0 x=9:y=24:gosub screen:print "0";:ar=0
if mid$(l1$,xx,1)<>tr$ gosub getterrain:x=24:y=24:gosub screen:print ms$;
x=xx:y=sy:gosub screen
goto mapmove
getterrain
a$=mid$(l1$,xx,1):if instr(a$,"ABCDEF") am=1:else am=0
y=yy:gosub getline2:b$=mid$(l2$,xx,1)
if a$="#" ms$="Impassable"
if a$=" " ms$="Land "
if a$=":" ms$="Water "
if a$="+" ms$="Empty Boat"
if a$="=" ms$="Deep Water"
if a$="*" ms$="City "
if (am) and (asc(a$)>96) and (asc(b$)<65) ms$="Army "
if (asc(a$)>96) and (am) and (asc(b$)>64) ms$="Army/Boat "
if (asc(a$)>64) and (asc(a$)<91) ms$="Army/City "
tr$=a$
return
armystrength
y=yy:gosub getline2
a$=mid$(l2$,xx,1)
if instr(a$,"0123456789") ar=val(a$):return
if instr(a$,"ABCDEFGHI") ar=asc(a$)-64:return
ar=0:return
; Scan the map for character CH$ and records coordinates in H:COORDS
;
ScanMap
x=40:y=bo:gosub screen
print \"Wait..scanning map... ";
kill "H:COORDS":create "H:COORDS"
kc=0:kb=0:if (asc(ch$)>96) and (asc(ch$)<123) kb=1:kb$=chr$(asc(ch$)-32)
for y = 2 to 45
gosub getline1:gosub getline2
ka=instr(ch$,l1$)
if not ka goto PastCheck
for x = ka to 79
ka$=mid$(l1$,x,1)
if kb and (ka$=kb$) then gosub FoundMatch
next
PastCheck
next:return
FoundMatch
close #1:open #1,"H:COORDS"
position #1,8,kc:print #1 x,y
position #1,8,kc+1:print #1 0,0
close #1:open #1,"H:WAR.MAP1"
kc=kc+1
return
;
; Read coordinates from "H:COORDS" and calls Move routine
; Make sure KC=0 before calling, and don't use KC in move routine
;
ReadCoords
close #1:open #1,"H:COORDS"
position #1,8,kc:input #1 kx,ky
close #1:open #1,"H:WAR.MAP1"
if (kx=0) and (ky=0) kc=kc-1:return
xx=kx:yy=ky
return
erase
y=yo:gosub getline1
a$=mid$(l1$,xo,1)
x=xo:y=so:gosub screen
print a$ ;
xo=xx:yo=yy:so=sy
return
pmap
gosub home
if ma=0 fn=1:else fn=24
for y=fn to fn+22
gosub getline1
print l1$
next
goto pmap2
printmap
gosub home
for y=1 to 23
gosub getline1
print l1$
next
pmap2
x=xx:y=yy:gosub getline1:gosub armystrength
x=1:y=24:gosub screen:print "Armies: ";ar;" ";
if te<>1 x=15:gosub screen:print "Terrain: ";ms$;
return
Screen
print #3 chr$(30);chr$(31+x);chr$(31+y);
if (pt) print #4 chr$(30);chr$(31+x);chr$(31+y);
if AN print #4 chr$(27); "["y";"x"f";
return
InvOn
print #3 chr$(15);
if (pt) print #4 chr$(15);
if an print #4 chr$(27);"[1m";
return
InvOff
print #3 chr$(14);
if (pt) print #4 chr$(14);
if an print #4 chr$(27);"[0m";
return
Home
print #3 chr$(12);
if (pt) print #4 chr$(12);
if an print #4 chr$(27);"[H";chr$(27);"[J";
return
rndm
zl$=rnd$
zl=((random(10000)+100)/100):if zl>100 then zl=zl-1
return
getline1
position #1,80,y-1
input #1,l1$
return
getline2
position #2,80,y-1
input #2,l2$
return
scrd2
if (an=1) and (info(0)) print #4,"3r";
if (info(0)) and (pt=1) y=23:x=1:gosub screen:print #4,"";
x=1:y=1:gosub screen:if (info(0)) and (pt=1) print #4,"";
if (info(0)) and (an=1) print #4,"M";
close
call -25088
open #1,"h:war.map1":open #2,"h:war.map2"
y=yy:gosub getline1
x=1:y=1:gosub screen
print l1$ ;
ys=ys+1
ke=ke+1
tp=tp-1
if (info(0)) and (an=1) print #4,"4r";
return
scru2
if (an=1) and (info(0)) print #4,"3r";
x=1:y=1:gosub screen:if (info(0)) and (pt=1) print #4,"";
if (info(0)) and (an=1) x=79:y=23:gosub screen:print #4,""
x=1:y=23:gosub screen:if (info(0)) and (pt=1) print #4,"";
poke 35,23
y=yy:gosub getline1
x=1:y=23:gosub screen:print #3
gosub screen
print l1$ ;
poke 35,24
tp=tp+1
ys=ys-1
ke=ke-1
if (info(0)) and (an=1) print #4,"4r";
return
scr3
kb=yy:kd=tp
for ka=1 to (tp-yy):yy=(kd-ka)+1:gosub scrolldown:next:yy=yy-1
if yy>=2:gosub scrolldown
yy=kb:tp=yy-1:return
scr4
kb=yy:kd=tp+22
if kd=yy gosub scrollup:tp=yy-21:return
for ka=1 to (yy-kd):yy=(kd+ka)-1:gosub scrollup:next:yy=yy+1
if yy<=45 gosub scrollup
yy=kb:tp=yy-21:return
link.term
link "a:war.start","termgame"